from rest_framework import routers
from mytest.views import UserViewSet
from mytest.view_test1 import ListUsers
from mytest.view_test1 import hello_world,ListUsersV2,hello_worldV2
from mytest.view_test2 import UserList
from mytest.view_test3 import ListUsersTest3V1,ListUsersTest3V2,ListUsersTest3V3
from mytest.view_test4 import UserListTest4V1,UserListTest4V2
from mytest.view_test5 import UserListTest5V1
# from movie_orders.pay_test import pay_test
from django.conf.urls import include,url
from mytest.cache_view import cache_view,BookViewSet
from django.views.decorators.cache import cache_page
from .filter_test1 import MoviesViewSet

from mytest.file_view import test_files

router = routers.DefaultRouter()
#post get
#list create
router.register(r'users', UserViewSet) #list retrieve update partial
router.register(r'test10',UserListTest4V2)
router.register(r'test14',BookViewSet)
router.register(r'filters/movie1',MoviesViewSet)
# router.register(r'test1',ListUsers,base_name='test1')

urlpatterns = [
    url(r'test1$',ListUsers.as_view()),
    url(r'test2',hello_world),
    url(r'test3',ListUsersV2.as_view()),
    url(r'test4',hello_worldV2),
    url(r'test5',UserList.as_view()),
    #url(r'test6',pay_test), #get post delete
    url(r'test7',ListUsersTest3V2.as_view()),
    url(r'test8',ListUsersTest3V3.as_view()),
    url(r'test9',UserListTest4V1.as_view()),
    url(r'test11',UserListTest4V2.as_view({'get':'retrieve'})),
    url(r'test12',UserListTest5V1.as_view()),
    url(r'^', include(router.urls)),
    #在url中取配置缓存系统
    url(r'^test13/$',cache_page(10)(cache_view)),
    url(r'^test15/$',test_files)
]